package Leetcode第一期;

//青蛙跳台原理 斐波那契数列
public class 斐波那契数列_10_1_2 {
    public static int fib(int n) {
        int a = 0, b = 1, sum = 0;
        for (int i = 0; i < n; i++) {
            sum = (a + b) % 1000000007;  //sum为第n+1
            a = b;  //a为第n-1
            b = sum; //b为n
        }
        return a;
    }

    public static void main(String[] args) {
        int i=-11;
        System.out.println(i%10);
    }

    public static int NumberOf1(int n) {
        int count = 0;
        while (n != 0) {
            count++;
            n = (n - 1) & n;
        }
        return count;
    }
}
